<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>创作者审核日志</title>
    <script src="/jquery/jquery-3.2.1.min.js"></script>
    <script src="/layui/layui.js"></script>
    <link rel="stylesheet" href="/layui/css/layui.css">
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .box{
            width: 100%;
            height: 1030px;
        }
        .list{
            width: 1650px;
            height: 50px;
            margin-left: 20px;
            background-color:rgb(243,243,243);
        }
        .list-left{
            width: 150px;
            height: 30px;
            margin-top: 10px;
            float: left;
        }
        .list-left-left{
            width: 10px;
            height: 30px;
            float: left;
            background: green;
        }
        .list-left-right{
            width: 100px;
            height: 30px;
            font-size: 14px;
            line-height: 30px;
            float: left;
            text-indent: 5px;
        }
        .list-right{
            float: right;
            margin-top: 5px;
            margin-right: 35px;
        }
        .query{
            width: 1650px;
            height: 100px;
            margin-top: 20px;
            margin-left: 20px;
        }
        .layui-col-md11{
            width: 100%;
        }
        .layui-card-header{
            background-color:rgb(243,243,243);
        }
        .query-top-right{
            float: right;
            margin-right: 20px;
        }
        .layui-form-label{
            width: 120px;
        }
        .layui-form-item .layui-input-inline {
            float: left;
            width: 240px;
            margin-right: 50px;
        }
        .record{
            width: 1650px;
            height: 821px;
            margin-top: 40px;
            margin-left: 20px;
            background-color:rgb(243,243,243);
        }
        .import{
            margin-left: 1050px;
        }
        #button_ids{
            display: none;
        }
        .layui-table-cell {
            line-height: 47px;
            height: inherit;
        }
        .layui-table-cell>a{
            color:green;
        }
        .layui-table-fixed {
            position: absolute;
            left: 0px;
            top: 0px;
            z-index: 101;
        }
        div#rMenu {position:absolute; visibility:hidden; top:0; background-color: #555;text-align: left;padding: 2px;}
        div#rMenu ul li {
            margin: 1px 0;
            padding: 0 5px;
            cursor: pointer;
            list-style: none outside none;
            background-color: #DFDFDF;
        }
        img{
            width: 100px;
            height: 116px;
        }
        .layui-table, .layui-table-view {
            margin: 10px 20px;
        }
    </style>
</head>
<body>
<div class="box">
    <!--用户列表-->
    <div class="list">
        <div class="list-left">
            <div class="list-left-left"></div>
            <p class="list-left-right">审核记录日志</p>
        </div>
        <div class="list-right">
            <div class="list-right-left layui-btn layui-icon layui-icon-refresh" onclick="refresh()">&nbsp;刷新</div>
            <div class="list-right-right layui-btn layui-icon layui-icon-left" id="goBack">&nbsp;返回</div>
        </div>
    </div>

    <!--状态搜索-->
    <div class="box-btngroup" style="margin-left: 30px;margin-top: 20px">
        <div class="layui-row">
            <button type="button" id="reviewed" class="layui-btn layui-btn-primary">已通过</button>
            <button type="button" id="rejected" class="layui-btn layui-btn-primary">已驳回</button>
        </div>
    </div>

    <!--筛选查询-->
    <div class="layui-row query">
        <div class="layui-col-md11">
            <div class="layui-card headerCenter">
                <div class="layui-card-header backColor">
                    <i class="layui-icon">&#xe615;</i>
                    筛选查询
                </div>
                <div class="layui-card-body">
                    <form class="layui-form">
                        <div class="layui-form-item">
                            <label class="layui-form-label">审核时间：</label>
                            <div class="layui-input-inline">
                                <input type="text" id="createDate" name="createDate" placeholder="请选择审核时间" autocomplete="off" class="layui-input">
                            </div>

                            <label class="layui-form-label">账号：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="account" class="layui-input" placeholder="请输入用户账号"/>
                            </div>

                            <label class="layui-form-label">姓名：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="nickname" id="nickname" class="layui-input" placeholder="请输入用户姓名"/>
                            </div>

                            <span style="float: right;margin-right: 20px">
                                <button type="button" class="layui-btn" onclick="search()">
                                    <i class="layui-icon layui-icon-search"></i> 搜索
                                </button>
                                <button type="reset" class="layui-btn layui-btn-warm">
                                    <i class="layui-icon layui-icon-refresh"></i> 重置
                                </button>
                            </span>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <!--数据列表-->
    <div class="record">
        <!--表-->
        <table id="demoTable" lay-filter="demoTable"></table>
    </div>
    <!--表头样式-->
    <div id="button_ids">
        <i class="layui-icon layui-icon-align-left"></i> 审核记录日志
    </div>
    <!--表内操作-->
    <div id="button_caozuo" style="display:none" >
        <a alt="删除" title="删除"  lay-event="deleteTable">删除</a>
    </div>
</div>

<p id="title" style="display: none;">创作者审核日志</p>

<script>
    layui.use(['jquery','layer','table','form','laydate'],function(){
        var $=layui.jquery;
        var layer=layui.layer;
        var table=layui.table;
        var form=layui.form;
        var laydate=layui.laydate;

        laydate.render({
            elem: '#createDate',
            type: 'datetime',
            trigger: 'click'
        })

        demoTable();

        refresh=function refresh(){
            location.reload();
        }

        getTable('','','');

        function getTable(createDate,account,nickname){
            var param={
                'createDate':createDate,
                'account':account,
                'nickname':nickname
            }
            $.ajax({
                url:"/JsAuditLog/getJsAuditLogList",
                data:param,
                type:"post",
                dataType:"json",
                success:function (data) {
                    demoTable(data.data);
                }
            })
        }

        search=function search(){
            var createDate=$("input[name=createDate]").val();
            var account=$("input[name=account]").val();
            var nickname=$("input[name=nickname]").val();
            getTable(createDate,account,nickname);
        }

        /*表格*/
        function demoTable(data){
            table.render({
                elem:'#demoTable',
                title:"委托书",
                data:data,
                toolbar:'#button_ids',
                limit:10,
                width:1610,
                page:{
                    layout:['count','prev','page','next','limit','skip','refresh'],
                    limits:[10,20,30],
                    first:"首页",
                    last:"尾页",
                },
                cols:[[
                    {type:'checkbox'},
                    {title: '序号',align:'center', templet: function (data) {
                        return data.LAY_INDEX;
                    }},
                    {field:"nickname",title:"用户姓名",align:'center',width:200},
                    {field:"account",title:"用户账号",align:'center',width:200},
                    {field:"userName",title:"审核人",align:'center',width:200},
                    {field:"createDate",title:"审核时间",align:'center',width:200},
                    {field:"remark",title:"备注",align:'center',width:200},
                    {field:"type",title:"审核状态",align:'center',width:200,templet:function(data){
                        if(data.type==1){
                            return "审核通过"
                        }else if(data.type==3){
                            return "审核驳回"
                        }
                    }},
                    {field:'',title:"操作",align:'center',width:200,toolbar:'#button_caozuo'}
                ]]
            })
        }

        table.on('tool(demoTable)',function (obj) {
            var event = obj.event;
            if (event == "deleteTable"){
                layer.confirm('确认要删除吗?', {icon: 3, title:'提示'}, function(index){
                    $.ajax({
                        url:"/JsAuditLog/deleteJsAuditLog",
                        data:{'auditLogId':obj.data.auditLogId},
                        type:"post",
                        dataType:"json",
                        success:function (data) {
                            layer.msg("已删除！！！");
                            getTable('','','');
                        }
                    })
                    layer.close(index);
                });
            }
        })

        //状态按钮切换效果
        $('.layui-row').children('.layui-btn').click(function () {
            $(this).removeClass('layui-btn-primary').siblings().addClass('layui-btn-primary');
        });

        $('#reviewed').click(function(){
            var param={
                'type':1
            }
            $.ajax({
                url:"/JsAuditLog/getJsAuditLogType",
                data:param,
                type:"post",
                dataType:"json",
                success:function (data) {
                    demoTable(data.data);
                }
            })
        })

        $('#rejected').click(function(){
            var param={
                'type':3
            }
            $.ajax({
                url:"/JsAuditLog/getJsAuditLogType",
                data:param,
                type:"post",
                dataType:"json",
                success:function (data) {
                    demoTable(data.data);
                }
            })
        })

        //返回按钮
        $('#goBack').click(function () {
            var title = $('#title').text();
            var iframe = parent.$('.iframe');
            $.each(iframe,function (i,item) {
                if(title == $(item).attr('_href')){
                    parent.$('#beforeHref').val($(item).attr('_href'));
                    parent.beforeHref();
                    return;
                }
            });
        });

        //现在时间
        function getTime(){
            var date=new Date();
            var year=date.getFullYear();
            var month=date.getMonth()+1;
            var day=date.getDate();
            var hour=date.getHours();
            var minute=date.getMinutes();
            var second=date.getSeconds();
            var dateStr = year+"-"+zeroFilling(month)+"-"+zeroFilling(day)+" "+zeroFilling(hour)+":"+zeroFilling(minute)+":"+zeroFilling(second);
            return dateStr;
        }
        function zeroFilling(data){
            if(data<10){
                data="0"+data;
            }
            return data;
        }

    })
</script>
</body>
</html>